package controller;

import view.GUI;
import view.DirectoryTree;

/**
 * The MainController Class create the GUI, DirectoryTree and adds ActionsListener.
 * It also is the entry point(main) for the program.
 *
 *
 */
public class MainController {
	
	/*****************************
	 * MEMBER
	 *****************************/
	private GUI mainGUI;
	
	/*****************************
	 * CONSTRUCTOR
	 *****************************/
	public MainController() {
		// initialize new GUI element
		this.mainGUI = new GUI();
		// make new DirectoryTree myTree
		DirectoryTree myTree = new DirectoryTree(this.mainGUI);
		// set DirectoryTree with myTree
		this.mainGUI.setDirectoryTree(myTree);
		// add new ButtonListener with new ActionListener from mainGUI
		this.mainGUI.addButtonListener(new ButtonActionListener(mainGUI));
		this.mainGUI.addImageCoverListener(new ImageCoverListener(mainGUI));
	
		//generate XML schema
		try {
			XMLCache.generateSchema();
			System.out.println("schema generiert");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	
	}
	
	/*****************************
	 * MAIN METHOD
	 *****************************/
	public static void main(String[] args) {
		// make new MainController element
		new MainController();
	}

}